<?php
defined('BME_INSERTION') or die('Error code: '.BME_INVALID_INSERT_ERROR);

$id=0;
switch($query){
	case 'dataset':
		$header="<h1>%%form_cDs_header%%</h1>";
		$form="
		<dd><label for='$query-".(++$id)."'>%%form_cDs_name%%</label><br/>&nbsp;</dd><dd>
			<input id='$query-$id' type='text' name='name' value='' size='50'
				title='%%form_cDs_name_t%%'/></dd><br/><br/>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_s_name%%</label><br/>&nbsp;</dd><dd>
			<input id='$query-$id' type='text' name='s_name' value='' size='50'
				title='%%form_cDs_s_name_t%%'/></dd><br/><br/>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_who%%</label><br/>&nbsp;</dd><dd>
			<textarea id='$query-$id' type='text' name='who' cols='50' rows='5'
				title='%%form_cDs_who_t%%'></textarea></dd><br/><br/>
		
		<dt>%%form_cDs_location%%</dt>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_loc_name%%</label><br/>&nbsp;</dd><dd>
			<input id='$query-$id' type='text' name='loc_name' value='' size='50'
				title='%%form_cDs_loc_name_t%%'/></dd><br/><br/>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_latitude%%</label><br/>&nbsp;</dd><dd>
			<input id='$query-$id' type='text' name='latitude' value='&deg; &rsquo; &rdquo; N/S' size='20'
				title='%%form_cDs_latitude_t%%'/></dd><br/><br/>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_longitude%%</label><br/>&nbsp;</dd><dd>
			<input id='$query-$id' type='text' name='longitude' value='&deg; &rsquo; &rdquo; E/W' size='20'
				title='%%form_cDs_longitude_t%%'/></dd><br/><br/>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_elevation%%</label><br/>&nbsp;</dd><dd>
			<input id='$query-$id' type='text' name='elevation' value='' size='20'
				title='%%form_cDs_elevation_t%%'/></dd><br/><br/>
		
		<dt>%%form_cDs_pcp%%</dt>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_pcp_values%%</label><br/>&nbsp;</dd><dd>
			<textarea id='$query-$id' name='pcp_values' cols='50' rows='7'
				title='%%form_cDs_pcp_values_t%%'>%%form_cDs_pcp_vars%%</textarea></dd><br/><br/>
		
		<dt>%%form_cDs_general%%</dt>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_description%%</label><br/>&nbsp;</dd><dd>
			<textarea id='$query-$id' name='description' cols='50' rows='5'
				title='%%form_cDs_description_t%%'></textarea></dd><br/><br/>
		<dd><label for='$query-".(++$id)."'>%%form_cDs_comments%%</label><br/>&nbsp;</dd><dd>
			<textarea id='$query-$id' name='comments' cols='50' rows='5'
				title='%%form_cDs_comments_t%%'></textarea></dd><br/><br/>
		";
	break;
	case 'sequences':
		require_once(BME_ROOT."core/Dataset.php");
		$Dss=new BME_Dataset();
		$optDs="";
		foreach($Dss->getAll() as $id){
			$Ds=new BME_Dataset($id);
			$optDs.="<option value='".$Ds->getId()."'>".$Ds->getName()."</option>";
		}
		$Dss->openDB();
		$res=$Dss->DBquery("desc `Sequence` `gen`");
		$row=$Dss->DBfetch_assoc($res);
		$types=split(",",ereg_replace("^enum\((.*)\)","\\1",$row["Type"]));
		$Dss->closeDB();
		$optGn="";
		foreach($types as $type) $optGn.="<option value=$type>".substr($type,1,-1)."</option>";
		$header="<h1>%%form_cSq_header%%</h1>";
		$form="
		<dd><label for='$query-".(++$id)."'>%%form_cSq_name%%</label><br/>&nbsp;</dd><dd>
			<select id='$query-$id' type='text' name='name'>$optGn</select></dd><br/><br/>
		<dd><label for='$query-".(++$id)."'>%%form_cSq_dataset%%</label><br/>&nbsp;</dd><dd>
			<select id='$query-$id' type='text' name='dataset'>$optDs</select></dd><br/><br/>
		<dd><label for='$query-".(++$id)."'>%%form_cSq_file%%</label><br/>&nbsp;</dd><dd>
			<input id='$query-$id' type='file' name='file' value='' size='20'
				title='%%form_cSq_file_t%%'/></dd><br/><br/>
		";
	break;
}

?>
